package Servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;

import Bean.Info;
import Service.InfoService;
import ServiceImpl.InfoServiceImpl;

/**
 * Servlet implementation class SelectInfoServlet
 */
public class SelectInfoServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
 
    public SelectInfoServlet() {
        super(); 
    }
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		response.setContentType("text/html charset = UTF-8");
		InfoService infoservice = new InfoServiceImpl();
		String car_id = request.getParameter("car_id");
		Info info = infoservice.selectAllInfoByCarId(car_id);
		request.setAttribute("info", info);
		request.setAttribute("isOk", true);
		request.getRequestDispatcher("select_info_of_car.jsp").forward(request, response);
	}

}
